import Vue from "vue";
import request from "@/itsoftUI/utils/request";
import qs from "qs";
const schoolIfnoUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/manager"
//学校信息api
export const apiSchoolList = {
	//列表
	List: function (page) {
		const data = {
			page
		};
		return request({
			url: schoolIfnoUrl + "/school/list",
			method: "post",
			data: qs.stringify(data)
		});
	},
	//提取信息
	Get: function (id) {
		const data = {
			id
		};
		return request({
			url: schoolIfnoUrl + "/school/get",
			method: "post",
			data: qs.stringify(data)
		});
	},
	//编辑
	Edit: function (data) {
		const config = {
			headers: {
				'Content-Type': 'application/json;charset=utf-8'
			},
		}
		return request.post(schoolIfnoUrl + "/school/edit", data, config)
	}
}

//校区信息api
export const apiDistrict = {
	//列表
	List: function (page) {
		const data = {
			page
		}
		return request({
			url: schoolIfnoUrl + "/district/list",
			method: "post",
			data: qs.stringify(data)
		});
	},
	//编辑 校区数据添加及编辑(存在ID表示编辑，不存在表示添加)
	Edit: function (data) {
		const config = {
			headers: {
				'Content-Type': 'application/json;charset=utf-8'
			},
		}
		return request.post(schoolIfnoUrl + "/district/edit", data, config)
	},
	// 删除
	Del: function (ids) {
		const data = {
			ids
		}
		return request({
			url: schoolIfnoUrl + "/district/del",
			method: "post",
			data: qs.stringify(data)
		});
	},
	//提取信息
	Get: function (id) {
		const data = {
			id
		};
		return request({
			url: schoolIfnoUrl + "/district/get",
			method: "post",
			data: qs.stringify(data)
		});
	},
}
//组织机构api
export const apiOrganize = {
	//列表
	List: function (data) {
		const config = {
			headers: {
				'Content-Type': 'application/json;charset=utf-8'
			},
		}

		return request.post(schoolIfnoUrl + "/organize/tree", data, config)
	},
	//编辑 组织机构数据添加及编辑(存在ID表示编辑，不存在表示添加)
	Edit: function (data) {
		const config = {
			headers: {
				'Content-Type': 'application/json;charset=utf-8'
			},
		}
		return request.post(schoolIfnoUrl + "/organize/edit", data, config)
	},
	// 删除
	Del: function (ids) {
		const data = {
			ids
		}
		return request({
			url: schoolIfnoUrl + "/organize/del",
			method: "post",
			data: qs.stringify(data)
		});
	},
	//提取信息
	Get: function (id) {
		const data = {
			id
		};
		return request({
			url: schoolIfnoUrl + "/organize/get",
			method: "post",
			data: qs.stringify(data)
		});
	},
}
// 组织机构列表
export function tree(data) {
	const config = {
		headers: {
			'Content-Type': 'application/json;charset=utf-8'
		},
	}

	return request.post(schoolIfnoUrl + "/organize/tree", data, config)
}
// 组织机构删除
export function organizeDel(ids) {
	const data = {
		ids
	}
	return request({
		url: schoolIfnoUrl + "/organize/del",
		method: "post",
		data: qs.stringify(data)
	});
}
// 组织机构添加
export function organizeEdit(data) {
	const config = {
		headers: {
			'Content-Type': 'application/json;charset=utf-8'
		},
	}
	return request.post(schoolIfnoUrl + "/organize/edit", data, config)
}